HOMEDIR := $(PWD)
PROJECT_NAME := $(HOMEDIR)

#the main dirs...
INC_DIR := $(PROJECT_NAME)/include
LIB_DIR := $(PROJECT_NAME)/lib
CONF_DIR := $(PROJECT_NAME)/etc
BIN_DIR := $(PROJECT_NAME)/bin
SRC_DIR := $(PROJECT_NAME)/src

#the src subdirs...
#SRC_OS_DIR := $(SRC_DIR)/os
#SRC_UTILS_DIR := $(SRC_DIR)/util
#SRC_CORE_DIR := $(SRC_DIR)/core

#RES_DIR := $(SRC_OS_DIR) $(SRC_UTILS_DIR) $(SRC_CORE_DIR)
#SUBDIR := $(RES_DIR) 
SUBDIR := $(SRC_DIR)

#LIB_OS_DIR := $(LIB_DIR)/os
#LIB_UTILS_DIR := $(LIB_DIR)/utils
#LIB_CORE_DIR := $(LIB_DIR)/core


DEBUG := n
ARCH := 64BIT
MEM_POOL:=n
#TEST_ENABLE := y
#LARGE_FILE := y

CFLAGS := -Wall -fPIC

ifeq ($(DEBUG), y)
        CFLAGS += -ggdb
else
        CFLAGS += -o2
endif

ifeq ($(ARCH),64BIT)
	CFLAGS += -mcx16
else
	CFLAGS += -m32
endif

ifeq ($(MEM_POOL),y)
	MACRO += -D_MEM_POOL_
endif

ifeq ($(DEBUG),y)
	MACRO += -DDEBUG_LOG
endif

LDFLAGS := -lpthread 

CC := gcc
AR := ar
LD := ld

MACRO := -D_SMP_ -D__USE_GNU

INCLUDE := -I ./ -I $(INC_DIR)

ifeq ($(ARCH),64BIT)
	MACRO += -D_X86_64_
else
	MACRO += -D_X86_32_
endif

ifeq ($(LARGE_FILE),y)
	MACRO += -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE
endif


CFLAGS_TEST := $(CFLAGS)
CFLAGS += $(MACRO) $(INCLUDE)
CFLAGS_TEST += $(MACRO_TEST) $(INCLUDE)
